package tx.bjdacp.model;

import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import tx.bjdacp.model.*;
import tx.bjdacp.dao.*;
import tx.bjdacp.service.*;
import tx.bjdacp.vo.query.*;


@Entity
@Table(name = "bjdacp_archive_catalog")
public class ArchiveCatalog extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;

	//alias
	public static final String TABLE_ALIAS = "药监档案案卷目录";
	public static final String ALIAS_ARCHIVE_CATALOG_ID = "archiveCatalogId";
	public static final String ALIAS_DRUG_SELL_UNIT_ID = "drugSellUnitId";
	public static final String ALIAS_SEQ_NUM = "序号";
	public static final String ALIAS_FILE_NUMBER = "档号";
	public static final String ALIAS_ARCHIVE_CATALOG_NAME = "案卷题名";
	public static final String ALIAS_YEAR = "年度";
	public static final String ALIAS_SHENPI_NUM = "审批号";
	public static final String ALIAS_PAGE_NUM = "页数";
	public static final String ALIAS_TIME_LIMIT = "期限";
	public static final String ALIAS_REMARK = "备注";

	//date formats


	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * archiveCatalogId       db_column: archive_catalog_id
     */

	private java.lang.Integer archiveCatalogId;
    /**
     * drugSellUnitId       db_column: drug_sell_unit_id
     */

	private java.lang.Integer drugSellUnitId;
    /**
     * seqNum       db_column: seq_num
     */

	private java.lang.Integer seqNum;
    /**
     * fileNumber       db_column: file_number
     */
	@Length(max=100)
	private java.lang.String fileNumber;
    /**
     * archiveCatalogName       db_column: archive_catalog_name
     */
	@Length(max=100)
	private java.lang.String archiveCatalogName;
    /**
     * year       db_column: year
     */
	@Length(max=100)
	private java.lang.String year;
    /**
     * shenpiNum       db_column: shenpi_num
     */
	@Length(max=100)
	private java.lang.String shenpiNum;
    /**
     * pageNum       db_column: page_num
     */
	@Length(max=100)
	private java.lang.String pageNum;
    /**
     * timeLimit       db_column: time_limit
     */
	@Length(max=100)
	private java.lang.String timeLimit;
    /**
     * remark       db_column: remark
     */
	@Length(max=1000)
	private java.lang.String remark;
	//columns END


	public ArchiveCatalog(){
	}

	public ArchiveCatalog(
		java.lang.Integer archiveCatalogId
	){
		this.archiveCatalogId = archiveCatalogId;
	}



	public void setArchiveCatalogId(java.lang.Integer value) {
		this.archiveCatalogId = value;
	}

	@Id	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "archive_catalog_id", unique = true, nullable = false, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getArchiveCatalogId() {
		return this.archiveCatalogId;
	}

	@Column(name = "drug_sell_unit_id", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getDrugSellUnitId() {
		return this.drugSellUnitId;
	}

	public void setDrugSellUnitId(java.lang.Integer value) {
		this.drugSellUnitId = value;
	}

	@Column(name = "seq_num", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getSeqNum() {
		return this.seqNum;
	}

	public void setSeqNum(java.lang.Integer value) {
		this.seqNum = value;
	}

	@Column(name = "file_number", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getFileNumber() {
		return this.fileNumber;
	}

	public void setFileNumber(java.lang.String value) {
		this.fileNumber = value;
	}

	@Column(name = "archive_catalog_name", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getArchiveCatalogName() {
		return this.archiveCatalogName;
	}

	public void setArchiveCatalogName(java.lang.String value) {
		this.archiveCatalogName = value;
	}

	@Column(name = "year", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getYear() {
		return this.year;
	}

	public void setYear(java.lang.String value) {
		this.year = value;
	}

	@Column(name = "shenpi_num", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getShenpiNum() {
		return this.shenpiNum;
	}

	public void setShenpiNum(java.lang.String value) {
		this.shenpiNum = value;
	}

	@Column(name = "page_num", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getPageNum() {
		return this.pageNum;
	}

	public void setPageNum(java.lang.String value) {
		this.pageNum = value;
	}

	@Column(name = "time_limit", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getTimeLimit() {
		return this.timeLimit;
	}

	public void setTimeLimit(java.lang.String value) {
		this.timeLimit = value;
	}

	@Column(name = "remark", unique = false, nullable = true, insertable = true, updatable = true, length = 1000)
	public java.lang.String getRemark() {
		return this.remark;
	}

	public void setRemark(java.lang.String value) {
		this.remark = value;
	}


	private Set totalCatalogs = new HashSet(0);
	public void setTotalCatalogs(Set<TotalCatalog> totalCatalog){
		this.totalCatalogs = totalCatalog;
	}

	@OneToMany(cascade = { CascadeType.MERGE }, fetch = FetchType.LAZY, mappedBy = "archiveCatalog")
	public Set<TotalCatalog> getTotalCatalogs() {
		return totalCatalogs;
	}

	private DrugSellUnit drugSellUnit;
	public void setDrugSellUnit(DrugSellUnit drugSellUnit){
		this.drugSellUnit = drugSellUnit;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumns({
		@JoinColumn(name = "drug_sell_unit_id",nullable = false, insertable = false, updatable = false)
	})
	public DrugSellUnit getDrugSellUnit() {
		return drugSellUnit;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("ArchiveCatalogId",getArchiveCatalogId())
			.append("DrugSellUnitId",getDrugSellUnitId())
			.append("SeqNum",getSeqNum())
			.append("FileNumber",getFileNumber())
			.append("ArchiveCatalogName",getArchiveCatalogName())
			.append("Year",getYear())
			.append("ShenpiNum",getShenpiNum())
			.append("PageNum",getPageNum())
			.append("TimeLimit",getTimeLimit())
			.append("Remark",getRemark())
			.toString();
	}

	public int hashCode() {
		return new HashCodeBuilder()
			.append(getArchiveCatalogId())
			.toHashCode();
	}

	public boolean equals(Object obj) {
		if(obj instanceof ArchiveCatalog == false) return false;
		if(this == obj) return true;
		ArchiveCatalog other = (ArchiveCatalog)obj;
		return new EqualsBuilder()
			.append(getArchiveCatalogId(),other.getArchiveCatalogId())
			.isEquals();
	}
}

